<?php 
class COrderlog extends Zend_Db_Table
{
	protected $_name;
	protected $_primary;
	public function __construct()
	{
		$this->_name=R_PRE. "order_log";
		parent::__construct();
	}
	
	public function getList($page = 1, $pageNum = 5)
	{
		$db = $this->getAdapter();
		$select = $db->select();
		$select->from($this->_name, array('*'))
			   ->limitPage($page, $pageNum);		
		$select->order('addtime desc');
		return $db->fetchAll($select);
	}

	public function getPageCount($pageNum = 5) 
	{
		$db = $this->getAdapter();
		$select = $db->select();
		$select->from($this->_name, array('*'));
		
		$select->order('addtime desc');
		$result = $db->fetchAll($select);
		return ceil(count($result)/$pageNum);
	}
}